/******************************************************/
/* Goblin's Cube - Rubik's cube game for Wii Homebrew */
/* Copyright (C) 2009 Ricardo Bueno Cordeiro          */
/* Licensed under de GNU General Public License v2.0  */
/*   See license_gplv2.txt for detalis                */
/******************************************************/

#ifndef __SOUND_H_
#define __SOUND_H_

#include <gccore.h>

#define SOUND_STATE_LOADED   0
#define SOUND_STATE_UNLOADED 1

class SoundLoader {
	public:
	virtual ~SoundLoader() {}
	virtual u32 get_size() = 0;
	virtual s32 get_pitch() = 0;
	virtual u16 get_num_bits_per_sample() = 0;
	virtual u16 get_num_channel() = 0;
	virtual void get_samples(void *buffer, u32 start, u32 size) = 0;
};

class Sound {
	private:
	u32 state;
	s32 format;
	s32 pitch;

	u32 size;
	void *aligned_samples;

	SoundLoader *sound_loader;

	void unload();

	public:
	Sound();
	~Sound();
	
	void load(SoundLoader *sl);
	void play(s32 delay, s32 sl, s32 sr);
};

void sound_init();
void sound_end();

#endif
